<template>
  <div class="xtx-wrapper">
    <div class="container">
      <h3 class="title">爆款推荐，人气好物推荐，它们最受欢迎</h3>
      <div class="xtx-simpla-title">－24小时热销－</div>
      <div class="xtx-mini-product">
        <ul class="clearfix">
          <li v-for="item in byDay" :key="item.id">
            <img class="square" :src="item.picture" alt="" />
            <p class="tit ellipsis">{{ item.name }}</p>
            <p class="desc ellipsis">{{ item.desc }}</p>
            <p class="price">¥{{ item.price }}</p>
          </li>
        </ul>
      </div>
      <div class="xtx-simpla-title">－24小时热销－</div>
      <div class="xtx-mini-product">
        <ul class="clearfix">
          <li v-for="item in byWeek" :key="item.id">
            <img class="square" :src="item.picture" alt="" />
            <p class="tit ellipsis">{{ item.name }}</p>
            <p class="desc ellipsis">{{ item.desc }}</p>
            <p class="price">¥{{ item.price }}</p>
          </li>
        </ul>
      </div>
      <div class="xtx-simpla-title">－24小时热销－</div>
      <div class="xtx-mini-product">
        <ul class="clearfix">
          <li v-for="item in byTotal" :key="item.id">
            <img class="square" :src="item.picture" alt="" />
            <p class="tit ellipsis">{{ item.name }}</p>
            <p class="desc ellipsis">{{ item.desc }}</p>
            <p class="price">¥{{ item.price }}</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'home-vogue',
  data () {
    return {
      byDay: [],
      byWeek: [],
      byTotal: []
    }
  },
  created () {
    this.$http.get('/home/inVogue').then((res) => {
      const { byDay, byWeek, byTotal } = res.data.result
      this.byDay = byDay
      this.byWeek = byWeek
      this.byTotal = byTotal
    })
  }
}
</script>

<style scoped lang='less'>
// 布局容器
.xtx-wrapper {
  background: #f5f5f5;
  line-height: 1.4;
  .container {
    width: 1240px;
    margin: 0 auto;
    .title {
      height: 215px;
      line-height: 215px;
      font-size: 32px;
      text-align: center;
      font-weight: normal;
    }
  }
}

// 小图商品
.xtx-mini-product {
  padding-top: 40px;
  padding-bottom: 20px;
  ul {
    li {
      width: 232px;
      height: 320px;
      float: left;
      background: white;
      margin-right: 20px;
      text-align: center;
      margin-bottom: 20px;
      &:nth-child(5n) {
        margin-right: 0;
      }
      img {
        width: 212px;
        height: 212px;
        display: block;
        margin: 10px;
        transition: all .5s;
        &:hover {
          transform: scale(1.05);
        }
      }
      p {
        padding: 0 20px;
      }
      .tit {
        padding-top: 4px;
        font-size: 16px;
      }
      .desc {
        padding-top: 4px;
        color: #999;
      }
      .price {
        font-size: 18px;
        color: @priceColor;
        padding-top: 6px;
      }
    }
  }
}

// - 简易标题 -
.xtx-simpla-title {
  height: 40px;
  font-size: 28px;
  text-align: center;
}

</style>
